Repository navigation
feat: PLP and SRP page type support for handoff mode - #35
Merged
Merged
Conversation
Extend the shopper-agent handoff shim to support category (PLP) and search results (SRP) pages alongside the existing PDP flow. - Add page-type, category-id, category-questions, search-query attributes - Extend HandoffEventDetail with pageContextType and pageContextData - Dynamic pill sourcing: pdpQuestions for PDP, categoryQuestions for PLP - Page-specific default placeholders - Widen CommerceAgentContext.page_context_data to Record<string, unknown>
Add buildPlpInlineContext() and buildSrpInlineContext() to product-context.ts so the widget sends the correct commerce_agent_context session variable on every SCRT2 message regardless of page type. Refactor the send path in WidgetProvider to use a unified resolveInlineContext() that switches on config.pageType: - pdp → buildPdpInlineContext (existing behavior) - plp → buildPlpInlineContext with categoryId - srp → buildSrpInlineContext with search query Replace productContextRef with a broader pageContextRef that carries all context-building fields to avoid stale closures in the sendMessage callback.
Pass categoryName (display name) in the handoff event so the storefront can set SRP context with a meaningful query. Adds category-name observed attribute and config field.
shilpi1998
marked this pull request as ready for review
November 17, 2026 13:56
shilpi1998
changed the base branch from
shilpi.mittal/hybrid-handoff-unify
to
main
November 17, 2026 18:16
- Fix second version entry in package-lock.json to match 0.4.0 - Add tests for buildPlpInlineContext and buildSrpInlineContext - Add ShopperAgentShim tests for PLP/SRP pills, placeholders, and handoff event context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
page-type,category-id,category-name,category-questions,search-queryHandoffEventDetailwithpageContextTypeandpageContextDataso the host storefront can seed the main agent with the right page context on handoffpdpQuestionsfor PDP,categoryQuestionsfor PLP, none for SRPNew attributes
page-type"pdp" | "plp" | "srp""pdp")category-idstring"mens-clothing-jackets")category-namestring"Men's Jackets")category-questionsJSON string[]pdp-questionssearch-querystringHandoff event changes
HandoffEventDetailnow optionally includes:The host storefront uses these to build the
commerce_agent_contextwhen opening the main Shopper Agent drawer.Companion PR
Test plan
plp_inlinecontextsrp_inlinecontext